<style>
    .layui-form .layui-form-item .layui-inline .layui-form-label {
        width: 150px;
        font-size: 18px;
        font-weight: bold;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline input{
        width: 400px;
        font-size: 17px;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline textarea{
        width: 400px;
        font-size: 17px;
    }
</style>
<form class="layui-form  seller-alone-form" id="userAdd" style="padding:20px;height: 600px;">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>
            <a href="{:url('index')}" style="color: #428bca;font-weight:bold;" >Message Manage</a> / Add
        </legend>
    </fieldset>
    <br/>
    <br/>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">Title：</label>
            <div class="layui-input-inline">
                <input type="text" name="title" value="{$data.title}"
                       lay-verify="required_en" maxlength="100"
                       lay-verType="tips"  class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">Content：</label>
            <div class="layui-input-inline" style="width: 800px;">
                <textarea id="content" name="content" style="display: none;">{$data.content}</textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="padding-top: 100px;">
        <div class="layui-input-block" >
            <input type="hidden" name="set_id" value="{$data.id}">
            <button type="button" class="layui-btn" lay-submit lay-filter="save">confirm</button>
            <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
        </div>
    </div>
</form>

<script>
    layui.use(['form','layedit'], function () {
        var form = layui.form;
        var layedit = layui.layedit;
        var editIndex = layedit.build('content');

        form.on('submit(save)', function(data){
            data.field.content = layedit.getContent(editIndex);
            JsPost("{:url('setEdit')}", data.field, function(res){
                if (res.code > 0) {
                    layer.msg(res.msg, {time: 1500, icon: 1}, function () {
                        window.location.href = "{:url('index')}";
                    });
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 2});
                }
            });
        });
    });
</script>
